home *** CD-ROM | disk | FTP | other *** search
- _global.subParserCLASS = function()
- {
- };
- _global.subParserCLASS.prototype.setOnData = function(target, method)
- {
- this.onDataTarget = target;
- this.onDataMethod = method;
- };
- _global.subParserCLASS.prototype.getOnData = function(target, name)
- {
- return this.onDataTarget[this.onDataMethod];
- };
- _global.subParserCLASS.prototype.unload = function()
- {
- clearInterval(this.subTypeParserInterval);
- delete this.sSubtitle;
- this.setOnData(null);
- this.subTypeParser.unload();
- delete this.subTypeParser;
- };
- _global.subParserCLASS.prototype.load = function(file, subObj)
- {
- this.unload();
- this.file = file;
- this.subObj = subObj;
- this.xDoc.onData = null;
- this.xDoc = new XML();
- this.xDoc.controller = this;
- this.xDoc.onData = function(str)
- {
- this.controller.sSubtitle = str;
- this.controller.onData();
- };
- this.xDoc.load(file);
- };
- _global.subParserCLASS.prototype.onData = function()
- {
- var type;
- type = this.file.split(".").pop();
- if(type == "srt")
- {
- this.subTypeParser = new _global.SRT_CLASS();
- }
- else
- {
- trace("Le type du fichier n\'a pu être determiné");
- this.onDataTarget[this.onDataMethod]();
- }
- this.subTypeParser.setOnData(this,"onParse");
- this.subTypeParser.parse(this.sSubtitle,this.subObj);
- };
- _global.subParserCLASS.prototype.onParse = function()
- {
- this.subTypeParser.unload();
- this.onDataTarget[this.onDataMethod](this.subObj);
- };
- _global.subParserCLASS.prototype.getBytesLoaded = function()
- {
- return !this.subTypeParser ? 0 : this.subTypeParser.index;
- };
- _global.subParserCLASS.prototype.getBytesTotal = function()
- {
- return this.sSubtitle != null ? this.sSubtitle.length : 0;
- };
-